import { mergeConfig } from 'vite';
import baseConfig from './vite.config.base';

// const target = "http://10.190.88.79/api/v1"
// const target = "http://10.190.100.91:10900/api/v1";
// const target1 = "http://10.190.100.91:10900/api/v1"
// const target2 = "http://10.190.100.36:10900/api/v1"
// const target3 = "http://10.190.100.74:10900/api/v1"
// const target4 = "http://10.190.88.85:10900/api/v1"
// const target5 = "http://10.190.100.35:10900/api/v1"
// const target6 = "http://10.190.100.73:10900/api/v1"
// const target7 = "http://10.190.88.176:10900/api/v1"
const target8 = 'http://10.190.88.135:10900/api/v1';
const imageTarget = (str: string) => {
  return str.split(':10900')[0];
};
// import.meta.env.VITE_URL = target;
process.env.VITE_URL = target8;
export default mergeConfig(
  {
    mode: 'development',
    server: {
      https: false,
      host: true,
      cors: true,
      open: true,
      strictPort: false,
      fs: {
        strict: true,
      },
      port: 11900,
      proxy: {
        '/api/v1': {
          target: target8,
          ws: true,
          /** 是否允许跨域 */
          changeOrigin: true,
          rewrite: (path) => path.replace('/api/v1', ''),
        },
        '/img': {
          target: imageTarget(target8),
          ws: true,
          /** 是否允许跨域 */
          changeOrigin: true,
        },
      },
    },
    plugins: [],
  },
  baseConfig
);
